﻿
function Get_DonVi_ById(ma) {
    var output;
    $.ajax({ url: _nameSubDomain + "/Donvi_ToQL/Get_DonVi_ById?maDV=" + ma, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function Get_toql_ById(ma) {
    var output;
    $.ajax({ url: _nameSubDomain + "/Donvi_ToQL/Get_toql_ById?maTo=" + ma, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function Get_quanhuyen_ById(ma) {
    var output;
    $.ajax({ url: _nameSubDomain + "/Donvi_ToQL/Get_quanhuyen_ById?maQuan=" + ma, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function getQHFirstByTo(ma) {
    var output;
    $.ajax({ url: _nameSubDomain + "/QuanHuyen/getQHFirstByTo?ma=" + ma, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function getList_PX_First_By_Quan_Huyen(maq, mato) {
    var output;
    $.ajax({ url: _nameSubDomain + "/QuanHuyen/getList_PX_First_By_Quan_Huyen?quanhuyenId=" + maq + "&toq=" +  mato, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}



function Get_MANGVT_ById(ma) {
    var output;
    $.ajax({ url: _nameSubDomain + "/MangVT/Get_MVT_ById?ma=" + ma, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function get_loai_thietbi_byId(ma) {
    var output;
    $.ajax({ url: _nameSubDomain + "/Dm_ThietBi/Get_LOAI_TB_ById?Id=" + ma, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function get_dm_thietbi_byId(ma) {
    var output;
    $.ajax({ url: _nameSubDomain + "/Dm_ThietBi/Get_DM_TB_ById?Id=" + ma, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function Get_vnpt_site_ById(id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/Vnpt_Site/Get_VNPT_SITE_ById?Id=" + id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function Get_Card_ById(id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TThietbi/Get_Card_ById?Id=" + id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function Get_Port_ById(id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TThietbi/Get_Port_ById?Id=" + id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function getTrangthaibyId(id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TThietbi/getTrangthaibyId?Id=" + id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function CheckLapDatTBDaDauNoi(id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TThietbi/CheckLapDatTBDaDauNoi?LapDatTB=" + id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function GetLapDatThietBiById(id) {
    var output = "";
    if (id != "" && id != null) {
        $.ajax({ url: _nameSubDomain + "/TThietbi/GetLapDatThietBiById?LapDatTBId=" + id, async: false }).done(function (data) {
            output = data;
        });
    }
    return output;
}

function GetThueBaoCssOntById(id) {
    var output ;
    $.ajax({ url: _nameSubDomain + "/ONTGpon/GetThueBaoCssOntById?Id=" + id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}


function Get_Roles_By_Id(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/PhanQuyen/RolesById?rolesId=" + Id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}


function Get_Menu_By_Id(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/Menu/GetMenuById?menuId=" + Id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function GetLoaiPhaById(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TThietbi/GetLoaiPhaById?Id=" + Id, async: false }).done(function (data) {
        output = data;
    });
    return output;
}

function Get_Odf_ById(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TCapquang/Get_Odf_ById?ma=" + Id, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function Get_SoiQuang_ById(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TCapquang/Get_SoiQuang_ById?ma=" + Id, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}



function Get_Odf_ById_Get_Ten(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TCapquang/Get_Odf_ById_Get_Ten?ma=" + Id, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function Get_loaiso_ById(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TCapquang/Get_loaiso_ById?ma=" + Id, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}

function Get_loailapdat_ById(Id) {
    var output;
    $.ajax({ url: _nameSubDomain + "/TCapquang/Get_loailapdat_ById?ma=" + Id, async: false }).done(function (data) {
        output = JSON.parse(data);
    });
    return output;
}



function ViewThueBaoOnOnt(laptbId, id, name) {

    loadwindowOnContent(_nameSubDomain + "/ONTGpon/ViewThueBaoGPON?laptbId=" + laptbId + "&tbId=" + id, "window_addupdate_view_thue_bao", "Thuê bao GPON của thiết bị " + name, 850, 450);

}

function load_conboxbox_updateUser(values)
{
    $("#Don_vi_on_add_user").combotree({
        url: _nameSubDomain + "/Donvi_ToQL/Get_DonVi_To_OnJson_NotFindType_AndSetParent_All",
        idField: "id",
        treeField: "text",
        onSelect: function (row) {

        },

    });

    setTimeout(function () {
        var _ArrayReviewers = values.split(",");
        $('#Don_vi_on_add_user').combotree('setValues', _ArrayReviewers);
    }, 300);

}

